﻿namespace TanzimSaqib.NoBrainer
{
    using System.Configuration;

    /// <summary>
    /// Registers the caching implementation.
    /// </summary>
    public class CacheManager
    {
        private static ICacheProvider _Cache;
        public static ICacheProvider Instance
        {
            get { return _Cache; }

            internal set 
            { 
                bool enabled;
                _Cache = bool.TryParse(ConfigurationManager.AppSettings[Constants.CachingEnabled], out enabled) && !enabled ? new NoCache() : value;
            }
        }

        public static string ControlList(string pageName)
        {
            return "ControlList=" + pageName;
        }

        public static string CmsMvcXml(string fullPath)
        {
            return "CmsMvcXml=" + fullPath;
        }
    }
}
